<?php

namespace yiike\goods\model;

use Yii;
use \yiike\goods\model\base\GoodsCategory as BaseGoodsCategory;
use yii\helpers\ArrayHelper;
use trntv\filekit\behaviors\UploadBehavior;
/**
 * This is the model class for table "ims_ttyc_goods_category".
 */
class GoodsCategory extends BaseGoodsCategory
{
    public $logo_file;
    public $banner_file;
    public function behaviors()
    {
        return ArrayHelper::merge(
            parent::behaviors(),
            [
                [
                    'class' => UploadBehavior::className(),
                    'attribute' => 'logo_file',
                    'pathAttribute' => 'logo',
                ],
                [
                    'class' => UploadBehavior::className(),
                    'attribute' => 'banner_file',
                    'pathAttribute' => 'banner',
                ],
            ]
        );
    }

    public function rules()
    {
        return [
            [['weid', 'store_id', 'name', 'orderby', 'status'], 'required'],
            [['weid', 'parent_id', 'store_id', 'orderby', 'status'], 'integer'],
            [['name'], 'string', 'max' => 50],
            [['logo_file','banner_file'],'safe'],
            [['logo', 'banner'], 'string', 'max' => 500]
        ];
    }
}
